<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="html"/>

	<xsl:template match="/">
		<html>
			<head>
			<style type="text/css" media="print">		
	body { margin:0 0 0 0;zoom: .7; }
	TABLE {
	TABLE-LAYOUT: auto; BORDER-COLLAPSE: collapse
}
.noprint{
display:none;
}
</style>
<style type="text/css" media="all">		
body{
margin:0 0 0 0;
font-family:arial;
}
#boxnota{
border:solid 1px #000;
font-size:10px;
text-align:center;
width:40px;
}

.TDTrimestre table tr td#boxnota{
border:none;
font-size:14px;
width:100px
}
.tbAlumno{
 BORDER-COLLAPSE: collapse;
 background-color: #732808; 
 width:100%;
}
.TDTitle {
	BORDER-RIGHT: #c7c8ca 2px solid; 
	BORDER-TOP: #c7c8ca 2px solid; BORDER-LEFT: #c7c8ca 2px solid; COLOR: #ffffff; BORDER-BOTTOM: #c7c8ca 2px solid; BACKGROUND-COLOR: #732808; TEXT-ALIGN: center
}
.TDNombre {
	BORDER-RIGHT: #732808 2px solid; 
	BORDER-TOP: #732808 2px solid; 
	PADDING-LEFT: 3px; FONT-WEIGHT: bold; FONT-SIZE: 14px; BORDER-LEFT: #732808 2px solid; COLOR: #ffffff; BORDER-BOTTOM: #732808 2px solid; HEIGHT: 30px; BACKGROUND-COLOR: #c8c9cb;
	WIDTH: 185px;
}
.TDAlumno{
	FONT-WEIGHT: bold; FONT-SIZE: 14px; COLOR: white; TEXT-ALIGN: center
}
.TDNombreMateria {
	FONT-WEIGHT: bold; 
	BACKGROUND-COLOR: #e0e2e1; 
	TEXT-ALIGN: center;
}
.TDNotas {
	BORDER: #732808 2px solid; 
	FONT-SIZE: 10px;  
	BACKGROUND-COLOR: #e0e1e3
	text-align:center;
	width:100px;

}
.TDNotasSPACE {
	BORDER: #732808 2px solid; 
	FONT-SIZE: 10px; 
	HEIGHT: 40px; BACKGROUND-COLOR: #732808
}
.TDTrimestre {
	FONT-SIZE: 12px; 
	HEIGHT: 40px; BACKGROUND-COLOR: #f0e1e3;
	BORDER: #732808 2px solid; 
	nowrap:nowrap;
	
}
.TDResumen {
	FONT-SIZE: 12px; 
	HEIGHT: 40px; BACKGROUND-COLOR:#E0C2C7;
	BORDER: #732808 2px solid; 
	width:200px;
	nowrap:nowrap;
	
}
.TDQuincena {
	FONT-SIZE: 12px; 
	COLOR: white; 
	BACKGROUND-COLOR: #732808; TEXT-ALIGN: center;
	BORDER: #732808 2px solid; 
}
.Bt {
	BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; CURSOR: hand; BORDER-BOTTOM: 0px
}
.n1,.n2,.n3,.n4,.n5,.n6,.n7,.n8,.n9,.n10{		text-align:center;}
.n1,.n2,.n3,.n4{	color:red;	}
.n5,.n6,.n7{	color:green;}
.n8,.n9,.n10{	color:blue;	}
</style>
<style type="text/css" media="screen">		
DIV#tbl-container {
	OVERFLOW: auto; WIDTH: 980px; HEIGHT: 500px
}
TABLE {
	TABLE-LAYOUT: auto; BORDER-COLLAPSE: collapse
}

THEAD TH {
	BORDER-RIGHT: silver 1px solid; FONT-WEIGHT: bold; FONT-SIZE: 10px; 
	POSITION: relative; TEXT-ALIGN: center
}
THEAD TH.locked {
	BORDER-RIGHT: silver 1px solid; FONT-WEIGHT: bold; FONT-SIZE: 10px; 
	 POSITION: relative; TEXT-ALIGN: center
}
THEAD TH {
	Z-INDEX: 20; 
	TOP: expression(document.getElementById("tbl-container").scrollTop-2)
}
THEAD TH.locked {
	Z-INDEX: 30; 
}
TD.locked {
	Z-INDEX: 10;
	LEFT: expression(parentNode.parentNode.parentNode.parentNode.scrollLeft); 
	POSITION: relative
}
TH.locked {
	Z-INDEX: 10; 
	LEFT: expression(parentNode.parentNode.parentNode.parentNode.scrollLeft); 
	POSITION: relative
}


</style>
			</head>
			<body>
				<table>
					<tbody>
						<tr>
							<td class="TDTitle">Planilla de Promedios de Calificaciones por Termino</td>
						</tr>
						<tr>
							<td>
								<xsl:apply-templates select="alumno"/>
							</td>
						</tr>
						<tr>
							<td>
								<div id="tbl-container">
									<xsl:call-template name="planilla"/>
								</div>
							</td>
						</tr>
					</tbody>
					<tfoot>
					<td style="text-aling:right" colspan="6"><img class="noprint" src="../datatest/print.jpg" onclick="window.print();" style="cursor:hand;"></img></td>
					</tfoot>
				</table>
				
				
			</body>
		</html>
	</xsl:template>


	<!--- HEAD ALUMNO -->
	<xsl:template match="alumno">
		<table class="tbAlumno">
			<tbody>
				<tr>
					<td class="TDNombre">Nombre Alumno</td>
					<td class="TDAlumno">
						<xsl:value-of select="@nombre"/>
					</td>
					<td class="TDNombre" style="width: 37px">Año</td>
					<td class="TDAlumno">
						<xsl:value-of select="@Anio"/>
					</td>
					<td class="TDNombre" style="width: 37px">División</td>
					<td class="TDAlumno">
						<xsl:value-of select="@Curso"/>
					</td>
				
				</tr>
			</tbody>
		</table>
	</xsl:template>
	<!--- HEAD ALUMNO -->


	<!--notas-->
	<xsl:template name="planilla">
		<table id="tbl" width="100%">
			<thead class="TDNombreMateria">
				<th class="locked" >&#xA0;</th>
				<xsl:apply-templates select="alumno/Materias/Materia[@Tipo=1]"/>
				<th class="TDNotasSPACE" >&#xA0;</th>
				<xsl:apply-templates select="alumno/Materias/Materia[@Tipo=2]"/>
			</thead>
			<tbody>
				<xsl:apply-templates select="alumno/Periodos/Periodo"/>
				<xsl:apply-templates select="alumno/Periodos/Resumen"/>
			</tbody>
		</table>
	</xsl:template>

	<!--materias-->
	<xsl:template match="Materia">
		<th>
			<xsl:value-of select="@Nombre"/>
		</th>
	</xsl:template>

	<!--Periodos-->
	<xsl:template match="Periodo">
		<tr>
			<xsl:variable name="idper">
				<xsl:value-of select="@IdPeriodo"/>
			</xsl:variable>
			<xsl:variable name="idEstilo">
				<xsl:value-of select="@Estilo"/>
			</xsl:variable>
			<td><xsl:attribute name="class">locked <xsl:value-of select="@Estilo"/></xsl:attribute>
				<xsl:choose>
					<xsl:when test="@FechaHasta=''"><xsl:value-of select="@FechaDesde"/></xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="@Particion"/>
						<br/>
						<xsl:value-of select="@FechaDesde"/> al <xsl:value-of select="@FechaHasta"/></xsl:otherwise>
				</xsl:choose>
			</td>
			<xsl:call-template name="GrupoNotas">
				<xsl:with-param name="idEstilo">
					<xsl:value-of select="$idEstilo"/>
				</xsl:with-param>
				<xsl:with-param name="idPer">
					<xsl:value-of select="$idper"/>
				</xsl:with-param>
				<xsl:with-param name="tipo">1</xsl:with-param>
			</xsl:call-template>
			<td class="TDNotasSPACE">
			</td>
			<xsl:call-template name="GrupoNotas">
				<xsl:with-param name="idEstilo">
					<xsl:value-of select="$idEstilo"/>
				</xsl:with-param>
				<xsl:with-param name="idPer">
					<xsl:value-of select="$idper"/>
				</xsl:with-param>
				<xsl:with-param name="tipo">2</xsl:with-param>
			</xsl:call-template>
		</tr>
		<tr>
		</tr>
	</xsl:template>

	<xsl:template match="Resumen">
	<tr>
			<td class="locked TDResumen"><xsl:value-of select="@Nombre"/></td>
			<xsl:for-each select="materia[@tipomateria=1]">
			<td class="TDResumen">&#160;</td>
			</xsl:for-each>
			<td class="TDNotasSPace">&#160;</td>
			<xsl:for-each select="materia[@tipomateria=2]">
			<td class="TDResumen">&#160;</td>
			</xsl:for-each>
			</tr>
	</xsl:template>

	
	<xsl:template name="GrupoNotas">
		<xsl:param name="idPer"/>
		<xsl:param name="idEstilo"/>
		<xsl:param name="tipo"/>
		<xsl:for-each select="/alumno/Materias/Materia[@Tipo=$tipo]">
			<td class="TDNotas">
				<xsl:if test="$idEstilo='TDTrimestre'">
					<xsl:attribute name="class">
						<xsl:value-of select="$idEstilo"/>
					</xsl:attribute>
				</xsl:if>
				<xsl:variable name="idmate">
					<xsl:value-of select="@IdMateria"/>
				</xsl:variable>
				<!--tengo las notas-->
				<table><xsl:for-each select="/alumno/Periodos/Periodo[@IdPeriodo=$idPer and @Estilo=$idEstilo]/materia[@IdMateria=$idmate]/nota">
				<tr><xsl:apply-templates select="modalidad"/></tr>
				</xsl:for-each>
			</table>
			</td>
		</xsl:for-each>
	</xsl:template>

	<xsl:template match="modalidad">
		<td id="boxnota"><xsl:attribute name="class">n<xsl:value-of select="round(@nota)"/></xsl:attribute>
			<xsl:attribute name="title"><xsl:value-of select="../@Modalidad"/>/<xsl:value-of select="@observacion"/></xsl:attribute>
			<xsl:if test="@nota=0">&#xA0;</xsl:if><xsl:if test="../@Modalidad=Promedio"></xsl:if>
			<xsl:if test="not(@nota=0)"><xsl:value-of select="@Letra"/></xsl:if></td>
	</xsl:template>
	<!--notas-->
	<xsl:template match="nota">
		<td><xsl:value-of select="@nota"/></td>
	</xsl:template>

	
</xsl:stylesheet><!-- Stylus Studio meta-information - (c)1998-2004. Sonic Software Corporation. All rights reserved.
<metaInformation>
<scenarios ><scenario default="yes" name="Scenario1" userelativepaths="yes" externalpreview="no" url="..\..\..\..\Temp\boletin.xml" htmlbaseurl="" outputurl="" processortype="internal" profilemode="0" profiledepth="" profilelength="" urlprofilexml="" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/></scenarios><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/><MapperBlockPosition></MapperBlockPosition></MapperMetaTag>
</metaInformation>
-->